// -----------------------------------------------------------------------
//  <copyright file="IFunctionAuthService.cs" company="LiuliuSoft">
//      Copyright (c) 2022-2023 DaprPlus. All rights reserved.
//  </copyright>
//  <site>https://www.dapr.plus</site>
//  <last-editor>郭明锋</last-editor>
//  <last-date>2023-12-21 14:42</last-date>
// -----------------------------------------------------------------------

namespace DaprPlus.Authorization;

/// <summary>
/// 定义资源权限验证服务，各类资源的权限验证服务都应实现该接口
/// </summary>
public interface IAuthorizationService
{
    /// <summary>
    /// 获取 服务的资源类型
    /// </summary>
    ResourceType ResourceType { get; }

    /// <summary>
    /// 验证当前用户对指定资源的执行权限，包含API Action
    /// </summary>
    /// <param name="resource">资源信息</param>
    /// <param name="authConfig">权限配置</param>
    /// <returns></returns>
    Task<AuthorizationResult> Authorize(IResource resource, AuthConfig authConfig);
}
